#ifndef B2D_RENDEROPERATION_H
#define B2D_RENDEROPERATION_H

#include <vector>
#include "IndexBuffer.h"
#include "VertexBuffer.h"

NS_B2D_BEGIN



////////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief	Definition of an individual rendering operation.
/// 		These are sent to the graphics device to perform. There must be at least
/// 		one vertex buffer in the call. Indices, however, are optional and come in
/// 		two flavours, buffered and unbuffered.
////////////////////////////////////////////////////////////////////////////////////////////////////
class B2D_API RenderOperation final
{
public:
	typedef std::vector<VertexBuffer*> VertexBufferCollection;


	/// Type of primitive to use for the operation
	PrimitiveType		primitive;
	/// First vertex to render
	size_t					vertexOffset;
	/// Number of vertices to render
	size_t					vertexCount;


	/// Collection of vertex buffers to use, must be at least one
	VertexBufferCollection	vertexBuffers;
	/// Index buffer to use (if any)
	IndexBuffer*			indexBuffer;
	/// Index data (unbuffered indices)
	void*					unbufferedIndexData;
	/// Index type (unbuffered indices)
	IndexSize			unbufferedIndexSize;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// \brief	Default constructor. By default the primitive is set to triangles.
	////////////////////////////////////////////////////////////////////////////////////////////////////
	RenderOperation(void)
		: primitive(PrimitiveType::TRIANGLES)
		, vertexOffset(0)
		, vertexCount(0)
		, indexBuffer(nullptr)
		, unbufferedIndexData(nullptr)
		, unbufferedIndexSize(IndexSize::INT16_INDEX)
	{
	}
};


NS_B2D_END

#endif